package lib.paxos;

import java.io.Serializable;

import lib.ArgumentValidator;

/**
 * Prepare message of Paxos
 * @author abhip
 *
 */
public class PrepareMessage implements Serializable
{
    /**
     * serialVersionUID is a universal version identifier for a Serializable
     * class. Deserialization uses this number to ensure that a loaded class
     * corresponds exactly to a serialized object. If no match is found during
     * deserialization, an InvalidClassException is thrown.
     */
    private static final long serialVersionUID = -1881793022271939754L;

	private int roundID;

    private SequenceID sequenceID;
    public PrepareMessage(
            int roundID,
            SequenceID sequenceID)
    {
        ArgumentValidator.IsGreaterThanOrEqualTo("roundID", roundID, 0);
        ArgumentValidator.IsNotNull("sequenceID", sequenceID);

        this.roundID = roundID;
        this.sequenceID = sequenceID;
    }

    public int RoundID()
    {
        return roundID;
    }

    public SequenceID SequenceID()
    {
        return sequenceID;
    }

    @Override
	public String toString() 
    {
		return "PrepareMessage [roundID=" + roundID + ", sequenceID="
				+ sequenceID + "]";
	}
}
